﻿<Window x:Class="RL.wRouteRegistry"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Перечень маршрутов" Height="300" Width="740" Loaded="Window_Loaded">
    <Window.Resources>
        <CollectionViewSource x:Key="sourceRoute" />
        <DataTemplate x:Key="cellDel">
            <CheckBox IsEnabled="False" IsChecked="{Binding Path=del}" />
        </DataTemplate>
        <DataTemplate x:Key="cellNumber">
            <TextBlock Text="{Binding Path=number}" />
        </DataTemplate>
        <DataTemplate x:Key="cellName">
            <TextBlock Text="{Binding Path=name}" />
        </DataTemplate>
        <DataTemplate x:Key="cellRouteType">
            <TextBlock Text="{Binding Path=RouteType.name}" />
        </DataTemplate>
        <DataTemplate x:Key="cellPrice">
            <TextBlock Text="{Binding Path=price}" /> 
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <StackPanel Name="stackPanel1" Orientation="Horizontal">
            <Button Content="Добавить" Height="23" Name="buttonAdd" Width="75" Click="buttonAdd_Click" />
            <Button Content="Удалить" Height="23" Name="buttonDelete" Width="75" Click="buttonDelete_Click" />
            <Button Content="Редактировать" Height="23" Name="buttonEdit" Width="95" Click="buttonEdit_Click" />
        </StackPanel>
        <ListView Grid.Row="1" Name="listView1" ItemsSource="{Binding Source={StaticResource sourceRoute}}">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Выкл." Width="35" CellTemplate="{StaticResource cellDel}"/>
                    <GridViewColumn Header="№ Маршрута" Width="80" CellTemplate="{StaticResource cellNumber}"/>
                    <GridViewColumn Header="Маршрут" Width="300" CellTemplate="{StaticResource cellName}" />
                    <GridViewColumn Header="Вид" Width="190" CellTemplate="{StaticResource cellRouteType}"/>
                    <GridViewColumn Header="Цена" Width="190" CellTemplate="{StaticResource cellPrice}"/>
                </GridView>
            </ListView.View>
        </ListView>
        <StackPanel Grid.Row="2" Name="stackPanel2" Orientation="Horizontal">
            <Button Content="Выбрать" Height="23" Name="buttonSelect" Width="75" Click="buttonSelect_Click" Visibility="Hidden" />
        </StackPanel>
    </Grid>
</Window>
